commonlibsse_ng\re\h/
hkbProjectData.rs

1//! # hkbProjectData
2//!
3//! This module defines the `hkbProjectData` struct, which inherits from `hkReferencedObject`
4//! and represents project data in the Havok engine. It includes world-up vector, string data,
5//! and default event node information.
6
7use crate::re::hkRefPtr::hkRefPtr;
8use crate::re::hkReferencedObject::hkReferencedObject;
9use crate::re::hkVector4::hkVector4;
10use crate::re::offsets_rtti::RTTI_hkbProjectData;
11use crate::re::offsets_vtable::VTABLE_hkbProjectData;
12use crate::rel::id::VariantID;
13use std::mem;
14
15use super::hkbProjectStringData::hkbProjectStringData;
16
17/// Represents project data in the Havok engine.
18#[repr(C)]
19pub struct hkbProjectData {
20    /// Base class `hkReferencedObject`.
21    /// - Offset: `0x0`
22    pub __base: hkReferencedObject,
23
24    /// World-up vector in world space.
25    /// - Offset: `0x10`
26    pub worldUpWS: hkVector4,
27
28    /// Pointer to string data.
29    /// - Offset: `0x20`
30    pub stringData: hkRefPtr<hkbProjectStringData>,
31
32    /// Default event node (mapped as hkEnum).
33    /// - Offset: `0x28`
34    pub defaultEventNode: u8,
35
36    /// Padding for memory alignment.
37    /// - Offset: `0x29`
38    pub _pad29: [u8; 7],
39}
40
41/// Ensure the memory layout matches the C++ version.
42const _: () = {
43    assert!(mem::size_of::<hkbProjectData>() == 0x30);
44    assert!(mem::offset_of!(hkbProjectData, __base) == 0x0);
45    assert!(mem::offset_of!(hkbProjectData, worldUpWS) == 0x10);
46    assert!(mem::offset_of!(hkbProjectData, stringData) == 0x20);
47    assert!(mem::offset_of!(hkbProjectData, defaultEventNode) == 0x28);
48};
49impl crate::re::hkRefPtr::hkRefPtrCounted for hkbProjectData {}
50
51impl Default for hkbProjectData {
52    fn default() -> Self {
53        Self::new()
54    }
55}
56
57impl hkbProjectData {
58    /// Address & Offset of the runtime type information (RTTI) identifier.
59    pub const RTTI: VariantID = RTTI_hkbProjectData;
60
61    /// Address & Offset of the virtual function table.
62    pub const VTABLE: [VariantID; 1] = VTABLE_hkbProjectData;
63
64    /// Creates a new `hkbProjectData` instance with default values.
65    ///
66    /// - `worldUpWS`: Default `hkVector4`
67    /// - `stringData`: Null `hkRefPtr`
68    /// - `defaultEventNode`: Zero
69    #[inline]
70    pub fn new() -> Self {
71        Self {
72            __base: hkReferencedObject::new(),
73            worldUpWS: hkVector4::new(),
74            stringData: hkRefPtr::new(),
75            defaultEventNode: 0,
76            _pad29: [0; 7],
77        }
78    }
79}